package ru.ganyaev.utils;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.util.List;

import org.apache.commons.io.FileUtils;

public class BasicFileReader extends FileReader {
    @Override
    public List<String> readLines(Path filePath) throws FileReaderException {
        return readLines(filePath, Charset.defaultCharset());
    }

    @Override
    public List<String> readLines(Path filePath, Charset charset)
            throws FileReaderException {
        List<String> fileContent = null;
        try {

            fileContent = FileUtils.readLines(filePath.toFile(),
                    charset.toString());
        } catch (IOException e) {
            throw new FileReaderException("Can not read file " + filePath, e);
        }

        return fileContent;
    }
}
